package com.demo.controller;

import com.demo.pojo.Friendship;
import com.demo.pojo.FriendshipVO;
import com.demo.pojo.ResultVO;
import com.demo.pojo.User;
import com.demo.service.FriendshipService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;

/**
 * 好友更新控制类
 */
@Slf4j
@RestController
@RequestMapping("/friendship")
public class FriendshipController {
    @Autowired
    private FriendshipService friendshipService;
    /**
     * 添加好友
     */
    @PostMapping("/add")
    public ResultVO add(@RequestBody Friendship  friendship) {
        log.info("添加好友:{}", friendship);
        return friendshipService.add(friendship);
    }
    /**
     * 删除好友
     */
    @DeleteMapping("/delete")
    public ResultVO delete(@RequestBody Friendship  friendship) {
        log.info("删除好友:{}", friendship);
        return friendshipService.delete(friendship);
    }
    /**
     * 获取好友列表
     */
    @GetMapping("/list")
    public ResultVO<List<FriendshipVO>> list() {
        return friendshipService.getAlList();

    }
    /**
     * 同意/拒绝添加好友
     */
//    @PutMapping("/request")
//    public ResultVO request(@RequestBody Friendship friendship) {
//        log.info("更新好友:{}", friendship);
//
//    }

}
